home *** CD-ROM | disk | FTP | other *** search
/ Gigantic Games 2 / Gigantic Games 2.iso / pc / _b_ / blackjack / bj_trainer.amos / bj_trainer.amosSourceCode < prev   
AMOS Source Code  |  1994-12-23  |  53KB  |  2,030 lines

  1. '======================================= 
  2. '           BLACKJACK TRAINER           +
  3. '          by Peter Cartwright          +      
  4. '  With much thanks to Kevin Hall &     +
  5. '    others on CIX for suggestions      +
  6. '             and help.                 +        
  7. '  Also much thanks to Aaron Fothergill +
  8. '  for pointing out the Randomiser bug  +
  9. '     which was causing the compiled    +  
  10. '          version to crash.            +              
  11. '++++++++++++++++++++++++++++++++++++++++
  12. Set Buffer 13
  13. Screen Open 0,320,256,8,Lowres
  14. Screen Close 0
  15. Dim TLX(3),TLY(3),BRX(3),BRY(3)
  16. Dim HARD_DBL(3,10),SOFT_DBL(8,10),HARD_HIT(6,10),SOFT_HIT(4,10),SPLIT(10,10)
  17. Dim CARD_PACK(208),NUM_OF_ACES(3),SOFT(3),PL4YER_COUNT(2)
  18. Dim PL4YERX(2),BUST(2),STAKE(2),DUBBLED(2),LINE$(3),BUTTON$(5),SPEED_ARR$(3)
  19. Global STAKE(),HAND,BLUE_CHIPS,RED_CHIPS,B0B,BANK,PL4YER_COUNT(),DEALER_COUNT
  20. Global NUM_OF_ACES(),SOFT(),POS,HAND,OWES_50P
  21. Global BANK,_OLD_BANK
  22. Global _HI,_LO
  23. Global _WINS,_LOSSES,_DRAWS,_BLACKJACKS,_SPLITS,_DOUBLES,HANDS
  24. Erase 3
  25. BOTTOM_CARD=197-(Rnd(8))
  26. T0P_CARD=0 : SPEED=7 : Set Talk 0,0,110,
  27. _LOAD_ARRAY : Rem Load speed array 
  28. ' Set starting positions for cards 
  29. PL4YERX(1)=208 : PL4YERX(2)=110 : PL4YERY=36 : DEALERX=132 : DEALERY=0 : RESTART=True
  30. Load "trainer:gameover5.abk",3
  31. Load "Trainer:dj_noises1.abk",5
  32. Load "Trainer:blackjack.abk"
  33. Randomize Timer
  34. _SET_UP_1ST_SCREENS
  35. FRONT_END:
  36. Screen 1
  37. Get Sprite Palette 
  38. Screen To Front 1
  39. Wait Vbl 
  40. RESTART=False
  41. T0P_CARD=0
  42. Clear Key 
  43. Auto View Off 
  44. Wait 28
  45. Menu$(1)="Details "
  46. Menu$(2)="Options "
  47. Menu$(3)="Info.   "
  48. 'Details   
  49. Menu$(1,1)="Credits "
  50. 'options   
  51. Menu$(2,1)="Play with Help       "
  52. Menu$(2,2)="Play without Help    "
  53. Menu$(2,3)="Set Speed            "
  54. Menu$(2,4)="Edit Strategy        "
  55. Menu$(2,5)="Save Strategy File   "
  56. Menu$(2,6)="Load Strategy File   "
  57. Menu$(2,7)="Test Current Strategy"
  58. Menu$(2,8)="Quit                 "
  59. 'Rules 
  60. Menu$(3,1)="How to Play.    "
  61. Menu$(3,2)="House Rules.    "
  62. Menu$(3,3)="About Strategy. "
  63. Menu$(3,4)="About Staking.  " : X=Free
  64. Menu On 
  65. Do 
  66.    'Screen Copy 1,8,0,16,8 To 1,0,0 
  67.    If Choice
  68.       FL=0
  69.       If Choice(1)=1 and Choice(2)=1
  70.          _PROCESS["details"]
  71.       End If 
  72.       If Choice(1)=2
  73.          If Choice(2)=1
  74.             HELPME=True
  75.             FL=1
  76.             Menu Off 
  77.          End If 
  78.          If Choice(2)=2
  79.             HELPME=False
  80.             FL=1
  81.             Menu Off 
  82.          End If 
  83.          If Choice(2)=3
  84.             SPEED$=SPEED_ARR$((SPEED-4)/3-1)
  85.             LINE$(0)="Select a Speed"
  86.             LINE$(1)="Current Speed "+SPEED$
  87.             BUTTON$(0)="Fast"
  88.             BUTTON$(1)="Med."
  89.             BUTTON$(2)="Slow"
  90.             Menu Off 
  91.             ALERT[22,8,1,2,3,2]
  92.             SPEED=Q*3+4
  93.             Menu On 
  94.          End If 
  95.          If Choice(2)=4
  96.             Menu Off 
  97.             _EDIT_STRATEGY
  98.             Screen Close 2 : Screen 1
  99.             Menu On 
  100.          End If 
  101.          If Choice(2)=5
  102.             _SAVE_STRAT
  103.          End If 
  104.          If Choice(2)=6
  105.             _LOAD_STRAT
  106.          End If 
  107.          If Choice(2)=7 : Paper 14 : Pen 15
  108.             Curs Off 
  109.             Locate 10,15 : Print "Loading Files"
  110.             Locate 11,16 : Print "Please Wait"
  111.             Screen Copy 1,8,0,16,8 To 1,0,0
  112.             Menu Off 
  113.             Screen Close 0 : Erase 1 : Menu Del 
  114.             Gosub TESTER
  115.             Erase 1 : Load "trainer:blackjack.abk"
  116.             _SET_UP_1ST_SCREENS
  117.             Screen Close 3
  118.             Exit 
  119.          End If 
  120.          If Choice(2)=8
  121.             Erase 1 : Erase 3 : Erase 5
  122.             End 
  123.          End If 
  124.          If FL=1
  125.             Gosub MAIN_BJ_LOOP
  126.          End If 
  127.       End If 
  128.       If Choice(1)=3
  129.          If Choice(2)=1
  130.             _PROCESS["_instruct"]
  131.             X=Free
  132.          End If 
  133.          If Choice(2)=2
  134.             _PROCESS["rules"]
  135.             X=Free
  136.          End If 
  137.          If Choice(2)=3
  138.             _PROCESS["strategy"]
  139.             X=Free
  140.          End If 
  141.          If Choice(2)=4
  142.             _PROCESS["staking"]
  143.             X=Free
  144.          End If 
  145.       End If 
  146.    End If 
  147. Loop 
  148. Goto FRONT_END
  149. MAIN_BJ_LOOP:
  150. Auto View On 
  151. _SCROLL_UP
  152. Screen To Front 0
  153. Screen Display 0,128,42,,
  154. Screen 0 : Get Sprite Palette : Screen Show 0
  155. Autoback 1
  156. SET_MAIN_ZONES
  157. AN$="A 6,(64,8)(65,8)" : Ink 2,3
  158. MAKE_PACK
  159. Gosub SHUFFLE
  160. BANK=200
  161. ' ST4RT is the main loop. We come here for each brand new hand 
  162. ST4RT:
  163. _UPDATE_BANK
  164. SPLIT=False : HAND_FINISHED=False : SPLIT_POSSIBLE=False : POS=0 : HAND=1 : B0B=1
  165. For I=1 To 2 : BUST(I)=False : DUBBLED(I)=False : Next I
  166. For I=1 To 3 : NUM_OF_ACES(I)=0 : SOFT(I)=False : Next I
  167. _TWO_ACES=False
  168. Gosub PLACE_BET
  169. ' PLACE_BET uses  bobs 1 and 2 for original bet  
  170. ' bobs 3 and 4 are used split  
  171. ' bobs 5 to  8 are used for doubles
  172. If RESTART=True : Rem  MENU has been pressed on play screen
  173.    Sprite Off 1
  174.    _SCROLL_DOWN
  175.    'Screen To Front 1 
  176.    Screen 1
  177.    'Get Sprite Palette  
  178.    Menu On 
  179.    Return 
  180. End If 
  181. STAKE(HAND)=BET
  182. B0B=8 : Rem B0B is now 8 and DEAL_CARD adds 1 more to start at 9.
  183. ' Deal 2 cards to player and 1 to dealer 
  184. PL0FFSETX=PL4YERX(HAND) : PL0FFSETY=PL4YERY
  185. Gosub DEAL_CARD : TEST1=RANK : ADJUST_HAND[HAND]
  186. Wait SPEED
  187. PL4YER_COUNT(HAND)=RANK
  188. PL0FFSETX=DEALERX : PL0FFSETY=DEALERY
  189. Gosub DEAL_CARD : Inc POS
  190. Wait SPEED
  191. ADJUST_HAND[3]
  192. DEALER_COUNT=RANK
  193. PL0FFSETX=PL4YERX(HAND) : PL0FFSETY=PL4YERY
  194. Gosub DEAL_CARD : Inc POS
  195. TEST2=RANK
  196. ADJUST_HAND[HAND]
  197. If TEST1=TEST2
  198.    SPLIT_POSSIBLE=True
  199. End If 
  200. PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
  201. If PL4YER_COUNT(HAND)=22
  202.    _TWO_ACES=True
  203.    Dec NUM_OF_ACES(HAND)
  204.    PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
  205. End If 
  206. If PL4YER_COUNT(HAND)=21
  207.    S$="Blackjack"
  208.    _NOTICE[S$]
  209.    _CLEAR_BOX
  210.    PL4YER_COUNT(HAND)=99
  211.    HAND_FINISHED=True
  212. End If 
  213. ADVICE_GIVEN=False
  214. ' Trap the 21 count on a split hand
  215. While HAND_FINISHED=False
  216.    If SPLIT and PL4YER_COUNT(HAND)=21
  217.       S$="Twenty One!"
  218.       _NOTICE[S$]
  219.       _CLEAR_BOX
  220.       HAND_FINISHED=True
  221.    End If 
  222.    If HELPME
  223.       If Not ADVICE_GIVEN
  224.          Gosub HELP
  225.          ADVICE_GIVEN=True
  226.       End If 
  227.    End If 
  228.    Repeat 
  229.       'trap split 21 
  230.       If HAND_FINISHED
  231.          NEWZONE=0
  232.          Exit 
  233.       End If 
  234.       NEWZONE=Mouse Zone
  235.       If Key State(95)=True Then Gosub HELP
  236.    Until Mouse Click and NEWZONE<>0
  237.    If NEWZONE=1
  238.       HAND_FINISHED=True
  239.    End If 
  240.    If NEWZONE=2
  241.       Gosub DEAL_CARD : Inc POS
  242.       ADVICE_GIVEN=False
  243.       ADJUST_HAND[HAND]
  244.       PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
  245.       'If bust, check for any fresh aces.
  246.       If PL4YER_COUNT(HAND)>21 and NUM_OF_ACES(HAND)>0
  247.          Dec NUM_OF_ACES(HAND)
  248.          PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
  249.          If NUM_OF_ACES(HAND)=0 : Rem only one unaccounted for ace was present 
  250.             SOFT(HAND)=False
  251.          End If 
  252.       End If 
  253.       If PL4YER_COUNT(HAND)>21 and PL4YER_COUNT(HAND)<>99
  254.          Wait SPEED
  255.          S$="Bust!"
  256.          _NOTICE[S$]
  257.          _CLEAR_BOX
  258.          HAND_FINISHED=True
  259.          BUST(HAND)=True
  260.          TAKE_MONEY
  261.       End If 
  262.       If PL4YER_COUNT(HAND)=21
  263.          S$="Twentyone!"
  264.          _NOTICE[S$]
  265.          _CLEAR_BOX
  266.          Wait SPEED
  267.          HAND_FINISHED=True
  268.       End If 
  269.       Wait SPEED : Rem avoid double hit?  
  270.    End If 
  271.    If NEWZONE=3 and SPLIT_POSSIBLE=True and SPLIT=False
  272.       If BANK<STAKE(HAND)
  273.          S$="Not enough cash."
  274.          _NOTICE[S$]
  275.          _CLEAR_BOX
  276.          NEWZONE=0
  277.       Else 
  278.          Gosub _SPLIT_PROC
  279.       End If 
  280.    End If 
  281.    '''' If the hand is soft (SOFT(hand)*10) will equal -10  
  282.    If NEWZONE=4 and PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<12 and POS=2
  283.       If BANK<STAKE(HAND)
  284.          S$="Not enough cash."
  285.          _NOTICE[S$]
  286.          _CLEAR_BOX
  287.          NEWZONE=0
  288.       Else 
  289.          Gosub _D0UBLE_PROC
  290.       End If 
  291.    End If 
  292.    If SPLIT=True and HAND=1 and HAND_FINISHED=True
  293.       HAND_FINISHED=False
  294.       Inc HAND
  295.       POS=2
  296.       PL0FFSETX=PL4YERX(HAND)
  297.       Channel 1 To Bob 30
  298.       AM$="Move -100,0,35"
  299.       Amal 1,AM$ : Amal On 
  300.       While Chanmv(1)
  301.       Wend 
  302.       Bell 
  303.       Wait 40
  304.       ADVICE_GIVEN=False
  305.    End If 
  306. Wend 
  307. If Not SPLIT
  308.    If BUST(1)
  309.       If BANK<1
  310.          GAME_LOST
  311.          BANK=200
  312.          RESTART=True
  313.       End If 
  314.       Bob Off : Wait Vbl 
  315.       Goto ST4RT
  316.    End If 
  317. End If 
  318. ' If both hands bust, no need for dealer to deal 
  319. If BUST(1) and BUST(2)
  320.    Bob Off : Wait Vbl 
  321.    Goto ST4RT
  322. End If 
  323. ' If player has blackjack, check to see if dealer can get one  
  324. If PL4YER_COUNT(HAND)=99
  325.    If DEALER_COUNT<>11 and DEALER_COUNT<>10
  326.       PAY_SIX_TO_4
  327.       Bob Off : Wait Vbl 
  328.       Goto ST4RT
  329.    End If 
  330. End If 
  331. POS=1
  332. HAND_DECIDED=False
  333. While DEALER_COUNT<17
  334.    PL0FFSETX=DEALERX : PL0FFSETY=DEALERY
  335.    Gosub DEAL_CARD : Inc POS
  336.    Wait SPEED
  337.    ADJUST_HAND[3]
  338.    DEALER_COUNT=DEALER_COUNT+RANK
  339.    ' Check for a dealer blackjack 
  340.    If DEALER_COUNT=21 and POS=2
  341.       HAND_DECIDED=True
  342.       S$="Dealer gets Blackjack."
  343.       _NOTICE[S$]
  344.       _CLEAR_BOX
  345.       If PL4YER_COUNT(HAND)=99
  346.          BANK=BANK+STAKE(HAND)
  347.          CLAIM_STAKE
  348.          Bob Off : Wait Vbl 
  349.          Exit 
  350.       Else 
  351.          TAKE_MONEY
  352.       End If 
  353.       Bob Off : Wait Vbl 
  354.       Exit 
  355.    End If 
  356.    If PL4YER_COUNT(HAND)=99 and POS=2
  357.       HAND_DECIDED=True
  358.       Wait 20
  359.       PAY_SIX_TO_4
  360.       Bob Off : Wait Vbl : Exit 
  361.    End If 
  362.    'If DEALER_COUNT>16 and DEALER_COUNT<22 and NUM_OF_ACES(3)>0 Then Exit 
  363.    'ADJUST "soft"HAND If BUST 
  364.    If DEALER_COUNT>21 and NUM_OF_ACES(3)>0
  365.       Dec NUM_OF_ACES(3) : Rem Adjustment made so cancel this ace.
  366.       DEALER_COUNT=DEALER_COUNT-10
  367.    End If 
  368. Wend 
  369. If HAND_DECIDED=True
  370.    If BANK<1
  371.       GAME_LOST
  372.       BANK=200
  373.       RESTART=True
  374.    End If 
  375.    Goto ST4RT
  376. End If 
  377. ' Who's won? 
  378. If Not SPLIT
  379.    If DEALER_COUNT>21
  380.       S$="Dealer Busts."
  381.       _NOTICE[S$]
  382.       PAY_EVENS
  383.       _CLEAR_BOX
  384.       Bob Off : Wait Vbl 
  385.       Goto ST4RT
  386.    End If 
  387.    If DEALER_COUNT>PL4YER_COUNT(HAND)
  388.       S$="Dealer Wins"
  389.       _NOTICE[S$]
  390.       TAKE_MONEY
  391.       _CLEAR_BOX
  392.       Wait 30
  393.       If BANK<1
  394.          GAME_LOST
  395.          BANK=200
  396.          RESTART=True
  397.       End If 
  398.       Bob Off : Wait Vbl 
  399.       Goto ST4RT
  400.    End If 
  401.    If DEALER_COUNT=PL4YER_COUNT(HAND)
  402.       S$="Stand Off."
  403.       _NOTICE[S$]
  404.       _CLEAR_BOX
  405.       BANK=BANK+STAKE(HAND)
  406.       CLAIM_STAKE
  407.       Bob Off : Wait Vbl 
  408.       Goto ST4RT
  409.    End If 
  410.    S$="Player Wins."
  411.    _NOTICE[S$]
  412.    PAY_EVENS
  413.    _CLEAR_BOX
  414.    Bob Off : Wait Vbl 
  415.    Goto ST4RT
  416. Else 
  417.    If DEALER_COUNT>21
  418.       S$="Dealer Busts."
  419.       _NOTICE[S$]
  420.       _CLEAR_BOX
  421.       For HAND=1 To 2
  422.          If BUST(HAND)=False
  423.          End If 
  424.          PAY_EVENS
  425.          _CLEAR_BOX
  426.       Next HAND
  427.       Bob Off 
  428.       Goto ST4RT
  429.    End If 
  430.    For HAND=1 To 2
  431.       If DEALER_COUNT>PL4YER_COUNT(HAND) and BUST(HAND)=False
  432.          If _VOICE_ON
  433.             Say "   Dealer wins hand"+Str$(HAND)+"."
  434.          Else 
  435.             S$="Dealer wins Hand "+Str$(HAND)+"."
  436.             _NOTICE[S$]
  437.          End If 
  438.          TAKE_MONEY
  439.          _CLEAR_BOX
  440.          Wait 30
  441.          If HAND=2
  442.             Bob Off : Wait Vbl 
  443.             If BANK<1
  444.                GAME_LOST
  445.                BANK=200
  446.                RESTART=True
  447.                Exit 
  448.             End If 
  449.          End If 
  450.       End If 
  451.       If DEALER_COUNT<PL4YER_COUNT(HAND) and BUST(HAND)=False
  452.          S$="Player Wins Hand "+Str$(HAND)+"."
  453.          _NOTICE[S$]
  454.          PAY_EVENS
  455.          _CLEAR_BOX
  456.          If HAND=2
  457.             Bob Off : Wait Vbl 
  458.          End If 
  459.       End If 
  460.       If DEALER_COUNT=PL4YER_COUNT(HAND) and BUST(HAND)=False
  461.          S$="Standoff on Hand "+Str$(HAND)+"."
  462.          _NOTICE[S$]
  463.          _CLEAR_BOX
  464.          BANK=BANK+STAKE(HAND)
  465.          CLAIM_STAKE
  466.          If HAND=2
  467.             Bob Off : Wait Vbl 
  468.          End If 
  469.       End If 
  470.    Next HAND
  471.    Bob Off : Wait Vbl 
  472.    Goto ST4RT
  473. End If 
  474. SHUFFLE:
  475. If _MODE=0 Then Text 124,88,"SHUFFLING"
  476. For I=208 To 2 Step -1
  477.    J=Rnd(I)
  478.    CARD_PACK(0)=CARD_PACK(J)
  479.    CARD_PACK(J)=CARD_PACK(I)
  480.    CARD_PACK(I)=CARD_PACK(0)
  481. Next I
  482. X=Free
  483. If _MODE=0
  484.    For I=1 To 3
  485.       Text 124,88,"SHUFFLING"
  486.       Sam Play 1,2,23800
  487.       Wait 50
  488.       Text 124,88,"          "
  489.       Wait 40
  490.    Next I
  491.    X=Free
  492. End If 
  493. Return 
  494. DEAL_CARD:
  495. If _MODE=0 Then Inc B0B
  496. Inc T0P_CARD
  497. If T0P_CARD=BOTTOM_CARD
  498.    If _MODE=0
  499.       Bob 42,POS*8+PL0FFSETX,POS*8+PL0FFSETY,62
  500.    End If 
  501.    Gosub SHUFFLE
  502.    T0P_CARD=1
  503.    BOTTOM_CARD=197-Rnd(8)
  504.    If _MODE=0
  505.       Bob Off 42
  506.       Wait Vbl 
  507.    End If 
  508. End If 
  509. SUIT=CARD_PACK(T0P_CARD)/100
  510. RANK=CARD_PACK(T0P_CARD) mod 100
  511. If _MODE=0
  512.    Bob B0B,POS*8+PL0FFSETX,POS*8+PL0FFSETY,9+(SUIT*13)+RANK
  513.    Sam Play 1,1,23000
  514.    Wait 3
  515. End If 
  516. X=Free
  517. Return 
  518. _SPLIT_PROC:
  519. SPLIT=True
  520. SPLIT_POSSIBLE=False : Rem Only one split allowed 
  521. Dec POS : Dec POS
  522. BANK=BANK-STAKE(HAND)
  523. If _MODE=0 Then Text 68,188,"�"+Str$(BANK)
  524. PL4YER_COUNT(1)=RANK
  525. PL4YER_COUNT(2)=RANK
  526. SOFT(HAND+1)=SOFT(HAND)
  527. If NUM_OF_ACES(1)=2 Then Dec NUM_OF_ACES(1)
  528. NUM_OF_ACES(2)=NUM_OF_ACES(1)
  529. STAKE(2)=STAKE(1)
  530. Inc POS
  531. ' Move bottom card across
  532. If _MODE=0
  533.    Channel 1 To Bob B0B
  534.    AM$="Move -106,-8,40"
  535.    Amal 1,AM$ : Amal On 
  536.    While Chanmv(1)
  537.    Wend 
  538.    Wait 20
  539.    If BLUE_CHIPS>0
  540.       _YOFFSET=186-Y Bob(1)
  541.    Else 
  542.       _YOFFSET=186-Y Bob(2)
  543.    End If 
  544.    AM$="Move 36,0,20"
  545.    AM2$="Move -64,-"+Str$(_YOFFSET)+",20"
  546.    Channel 1 To Bob 1
  547.    Channel 2 To Bob 2
  548.    Channel 3 To Bob 3
  549.    Channel 4 To Bob 4
  550.    'place extra chips 
  551.    If RED_CHIPS>0
  552.       Bob 4,160,186-BLUE_CHIPS*2,I Bob(2)
  553.       Amal 2,AM$
  554.       Amal 4,AM2$
  555.    End If 
  556.    If BLUE_CHIPS>0
  557.       Bob 3,160,186,I Bob(1)
  558.       Amal 1,AM$
  559.       Amal 3,AM2$
  560.    End If 
  561.    Amal On 
  562.    While Chanmv(1)
  563.    Wend 
  564. End If 
  565. For I=1 To 2
  566.    PL0FFSETX=PL4YERX(I) : PL0FFSETY=PL4YERY
  567.    Gosub DEAL_CARD
  568.    ADJUST_HAND[I]
  569.    PL4YER_COUNT(I)=PL4YER_COUNT(I)+RANK
  570.    ' check that it's not 2 aces 
  571.    If PL4YER_COUNT(I)>21
  572.       PL4YER_COUNT(I)=PL4YER_COUNT(I)-10
  573.       Dec NUM_OF_ACES(I)
  574.    End If 
  575.    Wait 5
  576. Next I
  577. If _MODE=0
  578.    Bob 30,225,15,63
  579.    Wait Vbl 
  580.    Bell 
  581.    Wait 40
  582. End If 
  583. Inc POS
  584. PL0FFSETX=PL4YERX(1)
  585. ADVICE_GIVEN=False
  586. Return 
  587. _D0UBLE_PROC:
  588. BANK=BANK-STAKE(HAND)
  589. DUBBLED(HAND)=True
  590. If _MODE=0 Then Text 68,188,"�"+Str$(BANK)
  591. STAKE(HAND)=STAKE(HAND)*2
  592. If _MODE=0
  593.    Channel 1 To Bob 5
  594.    Channel 2 To Bob 6
  595.    If HAND=2
  596.       HAND=3
  597.       Channel 1 To Bob 7
  598.       Channel 2 To Bob 8
  599.    End If 
  600.    If BLUE_CHIPS>0
  601.       Bob HAND+4,160,186,I Bob(1)
  602.       Wait Vbl 
  603.       AM$="Move "+Str$(X Bob(HAND)-160-20)+","+Str$(Y Bob(HAND)-186)+",20"
  604.       Amal 1,AM$
  605.    End If 
  606.    If RED_CHIPS>0
  607.       Bob HAND+5,160,186,I Bob(2)
  608.       Wait Vbl 
  609.       AM$="Move "+Str$(X Bob(HAND+1)-160-20)+","+Str$(Y Bob(HAND+1)-186)+",20"
  610.       Amal 2,AM$
  611.    End If 
  612.    If HAND=3
  613.       HAND=2
  614.    End If 
  615.    Amal On 
  616.    While Chanmv(1) or Chanmv(2)
  617.    Wend 
  618.    Wait Vbl 
  619.    Wait 35
  620. End If 
  621. Gosub DEAL_CARD
  622. If _MODE=0 Then Wait 20
  623. ADJUST_HAND[HAND]
  624. PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
  625. ' If over 21 an ace has been drawn to 11, so reduce by 10
  626. If PL4YER_COUNT(HAND)>21
  627.    PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
  628. End If 
  629. HAND_FINISHED=True
  630. Return 
  631. HELP:
  632. If POS=2 : Rem Splits and Doubles only on 3rd card
  633.    'first look for splits 
  634.    SPLIT_ADVICE=False
  635.    If SPLIT_POSSIBLE and HAND=1
  636.       SPLIT_HELP
  637.    End If 
  638.    If SPLIT_ADVICE
  639.       Return 
  640.    End If 
  641.    ' then check for doubles 
  642.    If PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<12
  643.       D0UBLE=False
  644.       If PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<9 and SOFT(HAND)
  645.          Gosub SOFT_DOUBLE_HELP
  646.       End If 
  647.       If PL4YER_COUNT(HAND)>8 and Not SOFT(HAND)
  648.          HARD_D0UBLE_HELP
  649.       End If 
  650.       If D0UBLE
  651.          Return 
  652.       End If 
  653.    End If 
  654. End If 
  655. ' Then look at soft hands
  656. If SOFT(HAND)
  657.    SOFT_HIT_HELP
  658. Else 
  659.    HARD_HIT_HELP
  660. End If 
  661. '
  662. Return 
  663. SOFT_DOUBLE_HELP:
  664. ' 201 to 270 SOFT_DBL
  665. _OFFSET=199
  666. PL4Y=19-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
  667. SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
  668. If SEL=1
  669.    LIGHT[4]
  670.    D0UBLE=True
  671. End If 
  672. Return 
  673. PLACE_BET:
  674. RESTART=False
  675. BET_PLACED=False
  676. BET=0
  677. _UPDATE_BANK
  678. BUTTONS_CLEAR=True
  679. Repeat : Rem incre/decrement bet until bet is placed
  680.    Z=Mouse Zone : K=Mouse Key
  681.    Wait 6
  682.    If K<>0 and BET=0
  683.       If Z=10
  684.          RESTART=True : Exit 
  685.       End If 
  686.       If Z=9
  687.          _SAVE_GAME
  688.       End If 
  689.       If Z=8
  690.          _LOAD_GAME
  691.       End If 
  692.    End If 
  693.    If K<>0
  694.       If Z=5
  695.          If K=1
  696.             If BET<25 and BANK>0
  697.                Inc BET
  698.                Dec BANK
  699.                _UPDATE_BANK
  700.             End If 
  701.          End If 
  702.          If K=2
  703.             If BET>0
  704.                Dec BET
  705.                Inc BANK
  706.                _UPDATE_BANK
  707.             End If 
  708.          End If 
  709.       End If 
  710.       If Z=6
  711.          If K=1
  712.             If BET<21 and BANK>4
  713.                BET=BET+5
  714.                BANK=BANK-5
  715.                _UPDATE_BANK
  716.             End If 
  717.          End If 
  718.          If K=2
  719.             If BET>4
  720.                BET=BET-5
  721.                BANK=BANK+5
  722.                _UPDATE_BANK
  723.             End If 
  724.          End If 
  725.       End If 
  726.    End If 
  727.    MAKE_CHIP_PILE[BET]
  728.    M0USE_CHIP_MOVE
  729.    Wait Vbl 
  730.    If K=1 and Z=7 and BET>0
  731.       BET_PLACED=True
  732.    End If 
  733. Until BET_PLACED
  734. If BET mod 5=0 Then Bob Off B0B+1 : Rem loose a loose sprite.
  735. Wait 10 : Rem this stops the mouse press carrying thru to next test. 
  736. Return 
  737. TESTER:
  738. _MODE=1
  739. Screen Open 0,320,256,8,Lowres
  740. Curs Off : Flash Off 
  741. Flash Off : Curs Off 
  742. Load "Trainer:tester.pic.pac",11
  743. Unpack 11 To 0 : Erase 11
  744. Screen Hide 0
  745. Load "trainer:tester_spr.abk"
  746. LINE1$="SUMMARY"
  747. LINE2$="======="
  748. LINE3$=" Session  Hands Splits Doubles B/Jacks Wins Losses Draws Prof/Loss"
  749. SESS$="Session No."
  750. STAKE$="Staking Plan No."
  751. Auto View Off 
  752. Screen Display 0,136,44,,
  753. Screen Open 3,320,256,8,Lowres
  754. Flash Off 
  755. Load "Trainer:stake_plans.pac",12
  756. Unpack 12 To 3 : Erase 12
  757. Palette 0,$FFF,$666,$0
  758. Screen Close 1
  759. Do 
  760.    Screen Hide 0
  761.    SESSION=1
  762.    Auto View On 
  763.    Gosub _GET_PLAN
  764.    Exit If PLAN=17 : Rem Zone 17 is the MENU button.
  765.    _GET_NUM_OF_SESSIONS
  766.    _GET_TOP_BOTTOM
  767.    _GET_NUM_HANDS
  768.    _GRAPH_PAPER
  769.    Screen To Back 3
  770.    Screen Open 2,640,512,2,Hires
  771.    Screen Hide 2 : Curs Off 
  772.    Palette 2,$FFF,$0
  773.    Locate 0,0 : Centre LINE1$
  774.    Locate 0,1 : Centre LINE2$
  775.    Locate 0,2 : Print LINE3$
  776.    Screen Show 0
  777.    Screen 0
  778.    Hide 
  779.    While SESSION<NUM_OF_SESSIONS+1
  780.       If SESSION>1 Then _GRAPH_PAPER
  781.       BOTTOM_CARD=197-(Rnd(8))
  782.       T0P_CARD=0
  783.       MAKE_PACK
  784.       Gosub SHUFFLE
  785.       _HI=0 : _LO=0 : BANK=0 : _OLD_BANK=0 : HANDS=0 : _WINS=0 : _LOSSES=0
  786.       _BLACKJACKS=0 : _DRAWS=0 : _SPLITS=0 : _DOUBLES=0
  787.       X#=0
  788.       STAKE(1)=_STARTING_STAKE
  789.       _ACC_TOT_STAKES=_ACC_TOT_STAKES+STAKE(1)
  790.       Gosub _RUN_TEST
  791.       Gosub _PRINT_SUM_LINE
  792.       Inc SESSION
  793.    Wend 
  794.    Gosub _PRINT_SUM_TOTALS
  795.    Screen To Front 2 : Screen Show 2
  796.    While Mouse Key=0
  797.    Wend 
  798.    Screen Hide 0
  799.    Screen Close 2
  800.    Show 
  801. Loop 
  802. ' PLAN 17 has been chosen in the Do Loop so return.
  803. Return 
  804. '  
  805. _RUN_TEST:
  806. RESULT$=""
  807. ST4RT2:
  808. Gosub _UPDATE_HI_LO
  809. _GRAPH
  810. If BANK<_LOWEST Then Screen Close 1 : Return 
  811. If BANK>_HIGHEST Then Screen Close 1 : Return 
  812. Inc HANDS
  813. If HANDS>NUM_OF_HANDS Then HANDS=HANDS-1 : Screen Close 1 : Return 
  814. SPLIT=False : HAND_FINISHED=False : SPLIT_POSSIBLE=False : HAND=1 : POS=0
  815. For I=1 To 2 : BUST(I)=False : DUBBLED(I)=False : Next I
  816. For I=1 To 3 : NUM_OF_ACES(I)=0 : SOFT(I)=False : Next I
  817. R$=RESULT$
  818. ' Add the name of your user defined Staking Plan subroutine. 
  819. On PLAN Gosub _STAKE1,_STAKE2,_STAKE3,_STAKE4,_STAKE5,_STAKE6,_STAKE7,_STAKE8
  820. _ACC_TOT_STAKES=_ACC_TOT_STAKES+STAKE(HAND)
  821. BANK=BANK-STAKE(HAND)
  822. ' Deal 2 cards to player and 1 to dealer 
  823. Gosub DEAL_CARD
  824. TEST1=RANK
  825. ADJUST_HAND[HAND]
  826. PL4YER_COUNT(HAND)=RANK
  827. Gosub DEAL_CARD
  828. ADJUST_HAND[3]
  829. DEALER_COUNT=RANK
  830. Inc POS
  831. Gosub DEAL_CARD
  832. Inc POS
  833. TEST2=RANK
  834. ADJUST_HAND[HAND]
  835. If TEST1=TEST2
  836.    SPLIT_POSSIBLE=True
  837. End If 
  838. PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
  839. If PL4YER_COUNT(HAND)=21
  840.    PL4YER_COUNT(HAND)=99
  841.    HAND_FINISHED=True
  842. End If 
  843. While HAND_FINISHED=False
  844.    If SPLIT and PL4YER_COUNT(HAND)=21
  845.       HAND_FINISHED=True
  846.    End If 
  847.    Gosub HELP
  848.    'NEWZONE will be set by HELP 
  849.    If NEWZONE=1
  850.       HAND_FINISHED=True
  851.    End If 
  852.    If NEWZONE=2
  853.       Gosub DEAL_CARD
  854.       Inc POS
  855.       ADJUST_HAND[HAND]
  856.       PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
  857.       'If bust, check for any fresh aces.
  858.       If PL4YER_COUNT(HAND)>21 and NUM_OF_ACES(HAND)>0
  859.          Dec NUM_OF_ACES(HAND)
  860.          PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
  861.          If NUM_OF_ACES(HAND)=0 : Rem only one unaccounted for ace was present 
  862.             SOFT(HAND)=False
  863.          End If 
  864.       End If 
  865.       If PL4YER_COUNT(HAND)>21 and PL4YER_COUNT(HAND)<>99
  866.          HAND_FINISHED=True
  867.          BUST(HAND)=True
  868.       End If 
  869.       If PL4YER_COUNT(HAND)=21
  870.          HAND_FINISHED=True
  871.       End If 
  872.    End If 
  873.    If NEWZONE=3 and SPLIT_POSSIBLE=True and SPLIT=False
  874.       Inc _SPLITS
  875.       Gosub _SPLIT_PROC
  876.    End If 
  877.    ' If the hand is soft (SOFT(hand)*10) will equal -10   
  878.    If NEWZONE=4 and PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<12 and POS=2
  879.       Inc _DOUBLES
  880.       Gosub _D0UBLE_PROC
  881.    End If 
  882.    If SPLIT=True and HAND=1 and HAND_FINISHED=True
  883.       HAND_FINISHED=False
  884.       Inc HAND
  885.       POS=2
  886.       ADVICE_GIVEN=False
  887.    End If 
  888. Wend 
  889. If Not SPLIT
  890.    If BUST(1)
  891.       Goto ST4RT2
  892.    End If 
  893. End If 
  894. ' If both hands bust, no need for dealer to deal 
  895. If BUST(1) and BUST(2) Then Goto ST4RT2
  896. ' If player has blackjack, check to see if dealer can get one  
  897. If PL4YER_COUNT(HAND)=99
  898.    If DEALER_COUNT<>11 and DEALER_COUNT<>10
  899.       BANK=BANK+STAKE(HAND)+(STAKE(HAND)*1.5)
  900.       Inc _BLACKJACKS
  901.       Goto ST4RT2
  902.    End If 
  903. End If 
  904. POS=1
  905. HAND_DECIDED=False
  906. While DEALER_COUNT<17
  907.    Gosub DEAL_CARD : Inc POS
  908.    ADJUST_HAND[3]
  909.    DEALER_COUNT=DEALER_COUNT+RANK
  910.    ' Check for a dealer blackjack 
  911.    If DEALER_COUNT=21 and POS=2
  912.       HAND_DECIDED=True
  913.       If PL4YER_COUNT(HAND)=99
  914.          BANK=BANK+STAKE(HAND)
  915.       End If 
  916.       Exit 
  917.    End If 
  918.    If PL4YER_COUNT(HAND)=99 and POS=2
  919.       HAND_DECIDED=True
  920.       BANK=BANK+STAKE(HAND)+(STAKE(HAND)*1.5)
  921.       Inc _BLACKJACKS
  922.       Exit 
  923.    End If 
  924.    If DEALER_COUNT>21 and NUM_OF_ACES(3)>0
  925.       Dec NUM_OF_ACES(3) : Rem Adjustment made so cancel this ace.
  926.       DEALER_COUNT=DEALER_COUNT-10
  927.    End If 
  928. Wend 
  929. If HAND_DECIDED Then Goto ST4RT2
  930. If Not SPLIT
  931.    ' dealer bust
  932.    If DEALER_COUNT>21
  933.       BANK=BANK+STAKE(HAND)*2
  934.       Goto ST4RT2
  935.    End If 
  936.    ' dealer equal 
  937.    If DEALER_COUNT=PL4YER_COUNT(HAND)
  938.       BANK=BANK+STAKE(HAND)
  939.       Goto ST4RT2
  940.    End If 
  941.    ' dealer wins do nothing 
  942.    If DEALER_COUNT>PL4YER_COUNT(HAND)
  943.       Goto ST4RT2
  944.    End If 
  945.    ' if its got this far player wins
  946.    BANK=BANK+STAKE(HAND)*2
  947.    Goto ST4RT2
  948. Else 
  949.    If DEALER_COUNT>21
  950.       For HAND=1 To 2
  951.          If BUST(HAND)=False
  952.             BANK=BANK+STAKE(HAND)*2
  953.          End If 
  954.       Next HAND
  955.       Goto ST4RT2
  956.    End If 
  957.    For HAND=1 To 2
  958.       If DEALER_COUNT<PL4YER_COUNT(HAND) and BUST(HAND)=False
  959.          BANK=BANK+STAKE(HAND)*2
  960.       End If 
  961.       If DEALER_COUNT=PL4YER_COUNT(HAND) and BUST(HAND)=False
  962.          BANK=BANK+STAKE(HAND)
  963.       End If 
  964.    Next HAND
  965.    Goto ST4RT2
  966. End If 
  967. '  
  968. '  
  969. 'Display screen 2 and allow selection of staking plan
  970. '
  971. _GET_PLAN:
  972. 'Get rid of last key press.
  973. Wait 15
  974. Screen 3
  975. Reserve Zone 
  976. Reserve Zone 17
  977. Z=0
  978. For X=22 To 232 Step 70
  979.    For Y=20 To 140 Step 40
  980.       Inc Z
  981.       Set Zone Z,X,Y To X+69,Y+40
  982.    Next Y
  983. Next X
  984. Set Zone 17,138,187 To 185,196
  985. M=0
  986. While M=0
  987.    PLAN=Mouse Zone
  988.    M=Mouse Key
  989.    ' Change the figure after PLAN> cope with added Staking Plans. 
  990.    If(PLAN>8 and PLAN<17) Then M=0
  991.    If PLAN=0 Then M=0
  992. Wend 
  993. If PLAN=17
  994.    _MODE=0
  995.    _ACC_TOT_HANDS=0
  996.    _ACC_TOT_BANK=0
  997.    _ACC_TOT_STAKES=0
  998.    _SAY_WAIT
  999.    Screen Close 0
  1000.    Return 
  1001. End If 
  1002. If PLAN=1 Then _STARTING_STAKE=5
  1003. If PLAN=2 Then _STARTING_STAKE=3
  1004. If PLAN=3 Then _STARTING_STAKE=3
  1005. If PLAN=4 Then _STARTING_STAKE=3
  1006. If PLAN=5 Then _STARTING_STAKE=6
  1007. If PLAN>5 Then _STARTING_STAKE=5
  1008. ' Add a line here to set your U/defined _STARTING_STAKE. 
  1009. Wait 8
  1010. Return 
  1011. '  
  1012. '
  1013. _UPDATE_HI_LO:
  1014. Screen 0
  1015. Curs Off 
  1016. If HANDS>0
  1017.    If BANK=_OLD_BANK
  1018.       Inc _DRAWS
  1019.       RESULT$="D"
  1020.    End If 
  1021. End If 
  1022. If BANK>_OLD_BANK Then Inc _WINS : RESULT$="W"
  1023. If BANK<_OLD_BANK Then Inc _LOSSES : RESULT$="L"
  1024. _OLD_BANK=BANK
  1025. If BANK>_HI Then _HI=BANK
  1026. If BANK<_LO Then _LO=BANK
  1027. Pen 0
  1028. Locate 5,1 : Print Using "####";HANDS;
  1029. If BANK<0 Then Pen 2
  1030. Locate 14,1 : Print Using " ###";BANK;
  1031. Pen 0
  1032. Locate 23,1 : Print Using " ###";_HI;
  1033. Pen 2 : Locate 32,1 : Print Using " ###";_LO; : Pen 0
  1034. Locate 5,3 : Print Using " ###";_WINS : 
  1035. Locate 14,3 : Print Using " ###";_LOSSES;
  1036. Locate 23,3 : Print Using " ###";_DRAWS;
  1037. Locate 32,3 : Print Using " ###";_BLACKJACKS;
  1038. Screen Copy 0,8,0,16,8 To 0,0,0
  1039. X=Free
  1040. Screen 1
  1041. Return 
  1042. '  
  1043. ' At the end of a session print summary on hidden screen 
  1044. '
  1045. _PRINT_SUM_LINE:
  1046. Screen 2 : Locate 2,SESSION+2
  1047. Print Using "##";SESSION;
  1048. Print Using "      ####";HANDS; : _TOT_HANDS=_TOT_HANDS+HANDS
  1049. Print Using "    ###";_SPLITS; : _TOT_SPLITS=_TOT_SPLITS+_SPLITS
  1050. Print Using "     ###";_DOUBLES; : _TOT_DOUBLES=_TOT_DOUBLES+_DOUBLES
  1051. Print Using "     ###";_BLACKJACKS; : _TOT_BLACKJACKS=_TOT_BLACKJACKS+_BLACKJACKS
  1052. Print Using "  ###";_WINS; : _TOT_WINS=_TOT_WINS+_WINS
  1053. Print Using "    ###";_LOSSES; : _TOT_LOSSES=_TOT_LOSSES+_LOSSES
  1054. Print Using "   ###";_DRAWS; : _TOT_DRAWS=_TOT_DRAWS+_DRAWS
  1055. Print Using "      -###";BANK; : _TOT_BANK=_TOT_BANK+BANK
  1056. X=Free
  1057. Return 
  1058. '  
  1059. ' After last session print the totals on hidden screen 
  1060. _PRINT_SUM_TOTALS:
  1061. Screen 2
  1062. Locate 1,SESSION+3 : Print "Totals:" : Locate 8,SESSION+3
  1063. Print Using "######";_TOT_HANDS; : _ACC_TOT_HANDS=_ACC_TOT_HANDS+_TOT_HANDS
  1064. _TOT_HANDS=0
  1065. Print Using "  #####";_TOT_SPLITS; : _TOT_SPLITS=0
  1066. Print Using "   #####";_TOT_DOUBLES; : _TOT_DOUBLES=0
  1067. Print Using "   #####";_TOT_BLACKJACKS; : _TOT_BLACKJACKS=0
  1068. Print Using "#####";_TOT_WINS; : _TOT_WINS=0
  1069. Print Using "  #####";_TOT_LOSSES; : _TOT_LOSSES=0
  1070. Print Using " #####";_TOT_DRAWS; : _TOT_DRAWS=0
  1071. Print Using "    -#####";_TOT_BANK; : _ACC_TOT_BANK=_ACC_TOT_BANK+_TOT_BANK
  1072. _TOT_BANK=0
  1073. Locate 1,SESSION+5 : Print "Accumulated Total Hands:    ";
  1074. Print Using "#######";_ACC_TOT_HANDS;
  1075. Locate 1,SESSION+6 : Print "Accumulated Profit/Loss:    ";
  1076. Print Using "-######";_ACC_TOT_BANK;
  1077. Locate 1,SESSION+7 : Print "Accumulated Amount Staked: ";
  1078. Print Using "########";_ACC_TOT_STAKES;
  1079. Locate 1,SESSION+8 : Print "House Edge:                    ";
  1080. Print Using "-###.##";-1*(_ACC_TOT_BANK*100.0)/_ACC_TOT_STAKES
  1081. Locate 10,21 : Print "Press Mouse Button for more Tests.";
  1082. X=Free
  1083. Return 
  1084. '  
  1085. ' Staking plans
  1086. '
  1087. _STAKE1:
  1088. ' Level Stake of 5 units per bet 
  1089. STAKE(1)=5
  1090. Return 
  1091. _STAKE2:
  1092. STAKE(1)=Rnd(24)+1
  1093. Return 
  1094. '
  1095. '
  1096. '
  1097. _STAKE3:
  1098. 'Starting stake = 3
  1099. 'After Win Add 3 to limit of 25
  1100. 'After Loss stake 3
  1101. If R$="W" Then STAKE(1)=STAKE(1)+3
  1102. If R$="L" Then STAKE(1)=3
  1103. If STAKE(1)>25 Then STAKE(1)=25
  1104. Return 
  1105. '  
  1106. '
  1107. '
  1108. _STAKE4:
  1109. ' Starting stake = 3 
  1110. ' After Win subtract 3 (unless the stake is 3) 
  1111. ' After loss add 3 to the limit of 25
  1112. If R$="W" Then STAKE(1)=3
  1113. If R$="L" Then STAKE(1)=STAKE(1)+3
  1114. If STAKE(1)>25 Then STAKE(1)=25
  1115. If STAKE(1)<3 Then STAKE(1)=3
  1116. Return 
  1117. '  
  1118. '
  1119. '
  1120. _STAKE5:
  1121. 'If BANK<0 Then STAKE(1)=Min((Abs(BANK)+6)/4,25) 
  1122. 'If BANK>=0 Then STAKE(1)=6
  1123. If BANK<0 Then STAKE(1)=Min((Abs(BANK)+6)/4,25) Else STAKE(1)=6
  1124. If STAKE(1)<6 Then STAKE(1)=6
  1125. Return 
  1126. '
  1127. '
  1128. '
  1129. _STAKE6:
  1130. 'If Bank>0 then enlarge the bet
  1131. 'If Bank+<0 the bet 6
  1132. If BANK>0 Then STAKE(1)=Min((BANK+6)/4,25) Else STAKE(1)=6
  1133. If STAKE(1)<6 Then STAKE(1)=6
  1134. Return 
  1135. '
  1136. '
  1137. '
  1138. _STAKE7:
  1139. ' If loose - Double until 25 
  1140. If R$="L" Then STAKE(1)=Min(25,STAKE(1)*2)
  1141. If R$="W" Then STAKE(1)=5
  1142. Return 
  1143. '  
  1144. '
  1145. '
  1146. _STAKE8:
  1147. ' If won - Double until 25 
  1148. If R$="W" Then STAKE(1)=Min(25,STAKE(1)*2)
  1149. If R$="L" Then STAKE(1)=5
  1150. Return 
  1151. '  
  1152. ' Put user defined Staking plans here.(_STAKE9 to _STAKE16)
  1153. '  
  1154. '
  1155. Procedure _GRAPH_PAPER
  1156.    Shared SESS$,SESSION,STAKE$,PLAN,X#
  1157.    Screen Open 1,960,164,8,Lowres
  1158.    Double Buffer : Curs Off : Flash Off : Get Sprite Palette 
  1159.    Autoback 0
  1160.    Screen 1
  1161.    Screen Hide 1
  1162.    Cls 1,0,0 To 959,160
  1163.    Screen Display 1,120,85,,
  1164.    Ink 7 : Draw 0,82 To 959,82 : Ink 5 : Draw 0,107 To 959,107
  1165.    Draw 0,32 To 959,32 : Draw 0,57 To 957,57 : Draw 0,132 To 959,132
  1166.    For P=0 To 959 Step 32 : Draw P,0 To P,160 : Next P
  1167.    Locate 27,1 : Print SESS$;SESSION;
  1168.    If PLAN<>0 Then Locate 27,3 : Print STAKE$;PLAN
  1169.    X=Free
  1170.    Screen Copy 1,48+X#,0,333+X#,156 To 0,18,40
  1171.    Autoback 2
  1172. End Proc
  1173. Procedure _GET_TOP_BOTTOM
  1174.    Shared LINE$(),BUTTON$(),Q,_LOWEST,_HIGHEST
  1175.    LINE$(0)="How many Units can you afford"
  1176.    LINE$(1)="to Loose per Session?"
  1177.    BUTTON$(0)="50"
  1178.    BUTTON$(1)="100"
  1179.    BUTTON$(2)="150"
  1180.    BUTTON$(3)="200"
  1181.    BUTTON$(4)="300"
  1182.    ALERT[34,8,1,2,5,2]
  1183.    Bell 
  1184.    If Q<5 Then _LOWEST=Q*-50 Else _LOWEST=-300
  1185.    Wait 15
  1186.    LINE$(0)="How many Units do you want"
  1187.    LINE$(1)="to Win per Session?"
  1188.    ALERT[34,8,1,2,5,2]
  1189.    Bell : Wait 8
  1190.    If Q<5 Then _HIGHEST=Q*50 Else _HIGHEST=300
  1191. End Proc
  1192. Procedure _GET_NUM_OF_SESSIONS
  1193.    Shared Q,LINE$(),BUTTON$(),NUM_OF_SESSIONS
  1194.    LINE$(0)="How many Test Sessions"
  1195.    LINE$(1)="do you want me to Play?"
  1196.    BUTTON$(0)="1"
  1197.    BUTTON$(1)="5"
  1198.    BUTTON$(2)="10"
  1199.    ALERT[34,8,1,2,3,2]
  1200.    Bell 
  1201.    If Q=1 Then NUM_OF_SESSIONS=Q Else NUM_OF_SESSIONS=(Q-1)*5
  1202.    Wait 15
  1203. End Proc
  1204. Procedure _GET_NUM_HANDS
  1205.    Shared LINE$(),BUTTON$(),Q,NUM_OF_HANDS
  1206.    LINE$(0)="How many hands do you want"
  1207.    LINE$(1)="me to play in each session?"
  1208.    BUTTON$(0)="250"
  1209.    BUTTON$(1)="500"
  1210.    BUTTON$(2)="750"
  1211.    BUTTON$(3)="1000"
  1212.    ALERT[34,8,1,2,4,2]
  1213.    Bell 
  1214.    NUM_OF_HANDS=Q*250
  1215.    X=Free
  1216. End Proc
  1217. Procedure SPLIT_HELP
  1218.    Shared SPLIT_ADVICE,_TWO_ACES
  1219.    ' 101 to 200 SPLIT_HELP
  1220.    _OFFSET=99
  1221.    PL4Y=PL4YER_COUNT(HAND)/2 : DEAL=DEALER_COUNT-1
  1222.    If _TWO_ACES Then PL4Y=11
  1223.    If PL4Y>6
  1224.       PL4Y=PL4Y-(PL4Y-6)*2
  1225.    Else 
  1226.       If PL4Y<>6
  1227.          PL4Y=PL4Y+(6-PL4Y)*2
  1228.       End If 
  1229.    End If 
  1230.    SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
  1231.    If SEL=1
  1232.       LIGHT[3]
  1233.       SPLIT_ADVICE=True
  1234.    End If 
  1235. End Proc
  1236. Procedure SOFT_HIT_HELP
  1237.    ' 1 to 40 Soft_HIT 
  1238.    _OFFSET=-1
  1239.    DEAL=DEALER_COUNT-1
  1240.    If PL4YER_COUNT(HAND)>16
  1241.       PL4Y=21-PL4YER_COUNT(HAND)
  1242.       If PL4Y<1 : Rem this stops 21 overflowing the array
  1243.          PL4Y=1 : Rem but gives the same advice
  1244.       End If 
  1245.       SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
  1246.       If SEL=1
  1247.          LIGHT[2]
  1248.       Else 
  1249.          LIGHT[1]
  1250.       End If 
  1251.    Else 
  1252.       LIGHT[2]
  1253.    End If 
  1254. End Proc
  1255. Procedure HARD_D0UBLE_HELP
  1256.    Shared D0UBLE
  1257.    _OFFSET=269
  1258.    PL4Y=12-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
  1259.    SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
  1260.    If SEL=1
  1261.       LIGHT[4]
  1262.       D0UBLE=True
  1263.    End If 
  1264. End Proc
  1265. Procedure HARD_HIT_HELP
  1266.    Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),D0UBLE
  1267.    ' 41  to 100   HARD_HIT
  1268.    _OFFSET=39
  1269.    If PL4YER_COUNT(HAND)<12
  1270.       LIGHT[2]
  1271.       Goto _EXIT
  1272.    End If 
  1273.    If PL4YER_COUNT(HAND)<18
  1274.       PL4Y=18-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
  1275.       SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
  1276.       If SEL=1
  1277.          LIGHT[2]
  1278.       Else 
  1279.          LIGHT[1]
  1280.       End If 
  1281.    Else 
  1282.       LIGHT[1]
  1283.    End If 
  1284.    _EXIT:
  1285. End Proc
  1286. Procedure _GRAPH
  1287.    Shared _GRAPHY,X#,NUM_OF_HANDS
  1288.    Screen Offset 1,HANDS,0
  1289.    If NUM_OF_HANDS>500
  1290.       X#=X#+0.5
  1291.    Else 
  1292.       X#=X#+1.0
  1293.    End If 
  1294.    _GRAPHX=X#+319
  1295.    _GRAPHY=82-_WINS+_LOSSES
  1296.    Bob 2,_GRAPHX,_GRAPHY-2,1
  1297.    Plot _GRAPHX,_GRAPHY,2
  1298.    _GRAPHY=82-BANK/4
  1299.    Bob 1,_GRAPHX,_GRAPHY-2,2
  1300.    Plot _GRAPHX,_GRAPHY,6
  1301.    Ink 2
  1302.    Sam Play 1,1,35000
  1303.    Screen Copy 1,48+X#,0,333+X#,156 To 0,18,40
  1304.    X=Free
  1305. End Proc
  1306. Procedure ADJUST_HAND[N]
  1307.    Shared RANK
  1308.    If RANK>10 Then RANK=10
  1309.    If RANK=1 Then RANK=11
  1310.    If RANK=11
  1311.       Inc NUM_OF_ACES(N)
  1312.       SOFT(N)=True
  1313.    End If 
  1314. End Proc
  1315. ' Thanks to Sprite editor for this Proc. 
  1316. Procedure ALERT[W,H,C1,C2,NB,NL]
  1317.    Shared Q,LINE$(),BUTTON$()
  1318.    Reserve Zone 
  1319.    Reserve Zone 5
  1320.    W=W*8
  1321.    H=H*8
  1322.    X=160-W/2
  1323.    Y=50-H/2
  1324.    Get Block 1,X,Y,W+16,H+16
  1325.    Ink 0
  1326.    Bar X+5,Y+5 To X+W+5,Y+H+5
  1327.    Ink C1
  1328.    Bar X,Y To X+W,Y+H
  1329.    Ink C2
  1330.    Box X+1,Y+1 To X+W-1,Y+H-1
  1331.    S=W/8/(NB+1)+1
  1332.    Paper C1
  1333.    Pen C2
  1334.    Curs Off 
  1335.    _S=Screen
  1336.    Screen Copy _S,8,0,16,8 To _S,0,0 : Screen Swap 
  1337.    Screen Copy _S,8,0,16,8 To _S,0,0 : Screen Swap 
  1338.    Screen Copy _S,8,0,16,8 To _S,0,0 : Screen Swap 
  1339.    Screen Copy _S,8,0,16,8 To _S,0,0 : Screen Swap 
  1340.    Wait Vbl 
  1341.    A=0 : While A<NB
  1342.       Locate X Text(X)+S/2+S*A,Y Text(Y+H)-2
  1343.       Print Border$(Zone$(BUTTON$(A),1+A),2);
  1344.    Inc A : Wend 
  1345.    A=0 : While A<NL
  1346.       Locate 0,Y Text(Y)+1+A
  1347.       Centre LINE$(A)
  1348.       Inc A
  1349.    Wend 
  1350.    Q=0
  1351.    While Q=0
  1352.       While Mouse Key=0 : Wend 
  1353.       Z=Mouse Zone
  1354.       If Z<1 or Z>1+NB
  1355.          Bell 
  1356.       Else 
  1357.          Q=Z
  1358.       End If 
  1359.    Wend 
  1360.    Put Block 1,X,Y
  1361. End Proc
  1362. Procedure CLAIM_STAKE
  1363.    Shared DUBBLED()
  1364.    TEMP_FL=DUBBLED(HAND)
  1365.    If HAND=2 Then HAND=3
  1366.    Channel 1 To Bob HAND
  1367.    Channel 2 To Bob HAND+1
  1368.    AM$="Move 0,40,25"
  1369.    If BLUE_CHIPS>0
  1370.       Amal 1,AM$
  1371.    End If 
  1372.    If RED_CHIPS>0
  1373.       Amal 2,AM$
  1374.    End If 
  1375.    If TEMP_FL and BLUE_CHIPS>0
  1376.       Channel 3 To Bob HAND+4 : Amal 3,AM$
  1377.    End If 
  1378.    If TEMP_FL and RED_CHIPS>0
  1379.       Channel 4 To Bob HAND+5 : Amal 4,AM$
  1380.    End If 
  1381.    If HAND=3 Then HAND=2
  1382.    Amal On 
  1383.    While Chanmv(1) or Chanmv(2) or Chanmv(3) or Chanmv(4)
  1384.    Wend 
  1385.    Wait 35
  1386. End Proc
  1387. Procedure _DRAW_CHARTS
  1388.    Z=0
  1389.    For X=1 To 5
  1390.       Read TLX,TLY,NUM_OF_ROWS
  1391.       For ROW=0 To NUM_OF_ROWS-1
  1392.          For _COLUMN=0 To 9
  1393.             Z=Z+1
  1394.             A=TLX+_COLUMN*8 : B=TLY+ROW*10
  1395.             If Peek(Start(8)+Z-1)=1
  1396.                Ink 3
  1397.             Else 
  1398.                Ink 1
  1399.             End If 
  1400.             Bar A+1,B+1 To A+7,B+9
  1401.             Ink 2
  1402.             Set Zone Z,A,B To A+8,B+10
  1403.          Next _COLUMN
  1404.       Next ROW
  1405.    Next X
  1406.    Data 20,30,4,20,99,6,120,30,10,220,30,7,221,129,3
  1407. End Proc
  1408. Procedure _EDIT_STRATEGY
  1409.    Change Mouse 3
  1410.    Auto View Off 
  1411.    Screen Open 2,320,256,4,Lowres
  1412.    Load Iff "trainer:strat_boxes.iff"
  1413.    Reserve Zone 
  1414.    Reserve Zone 300
  1415.    Flash Off : Curs Off 
  1416.    Palette 0,$380,$FFF,$F00
  1417.    _DRAW_CHARTS
  1418.    Auto View On 
  1419.    Screen To Front 2
  1420.    _DONE=False
  1421.    Do 
  1422.       _DRAW_CHARTS
  1423.       Change Mouse 2
  1424.       M=0
  1425.       While M=0
  1426.          M=Mouse Key
  1427.          If M=2 Then Goto _DONE
  1428.       Wend 
  1429.       Change Mouse 3
  1430.       OLD=Peek(Start(8)+Mouse Zone-1)
  1431.       If OLD=1 Then Poke(Start(8)+Mouse Zone-1),0
  1432.       If OLD=0 Then Poke(Start(8)+Mouse Zone-1),1
  1433.    Loop 
  1434.    _DONE:
  1435.    Change Mouse 1
  1436. End Proc
  1437. Procedure GAME_LOST
  1438.    Music 1
  1439.    Sprite Off 1 : Bob Off 
  1440.    Screen Open 2,320,200,16,Lowres
  1441.    Load Iff "trainer:BJ_game_end"
  1442.    Screen Display 2,,-142,,
  1443.    For Y=-142 To 64
  1444.       Screen Display 2,,Y,,
  1445.       Wait Vbl 
  1446.    Next 
  1447.    Wait 20
  1448.    Music Off 
  1449.    Reserve Zone 
  1450.    Reserve Zone(2)
  1451.    Set Zone 1,105,25 To 200,84
  1452.    Set Zone 2,105,111 To 200,170
  1453.    NEWZONE=0 : _DONE=False
  1454.    Repeat 
  1455.       If Mouse Zone=1 and Mouse Key<>0
  1456.          For Y=64 To -142 Step -4
  1457.             Screen Display 2,,Y,,
  1458.             Wait Vbl 
  1459.          Next Y
  1460.          Screen Close 2
  1461.          _DONE=True
  1462.       End If 
  1463.       If Mouse Zone=2 and Mouse Key<>0 Then End 
  1464.    Until _DONE
  1465. End Proc
  1466. Procedure LIGHT[ADVICE]
  1467.    Shared AN$,NEWZONE,_MODE
  1468.    If _MODE=0
  1469.       Sprite 1,185,137+ADVICE*16,65
  1470.       Channel 9 To Sprite 1
  1471.       Amal 9,AN$
  1472.       Amal On 9
  1473.    Else 
  1474.       NEWZONE=ADVICE
  1475.    End If 
  1476. End Proc
  1477. Procedure _LOAD_ARRAY
  1478.    Shared SPEED_ARR$()
  1479.    For S=0 To 2
  1480.       Read SPEED_ARR$(S)
  1481.    Next S
  1482.    Data "Fast","Med.","Slow"
  1483. End Proc
  1484. Procedure _LOAD_STRAT
  1485.    F$="" : While F$=""
  1486.       F$=Fsel$("*.STR",""," Load A STRATEGY FILE ")
  1487.       If F$<>""
  1488.          A$=Upper$(F$)
  1489.          If Right$(A$,4)<>".STR"
  1490.             F$=F$+".STR"
  1491.          End If 
  1492.          Bload F$,8
  1493.       Else 
  1494.          F$=" "
  1495.       End If 
  1496.    Wend 
  1497. End Proc
  1498. Procedure MAKE_CHIP_PILE[BET]
  1499.    RED_CHIPS=BET mod 5 : BLUE_CHIPS=Int(BET/5)
  1500.    If BET=0 Then RED_CHIPS=0
  1501. End Proc
  1502. Procedure MAKE_PACK
  1503.    Shared CARD_PACK()
  1504.    CARD=1
  1505.    For P4CK=1 To 4
  1506.       For RANK=1 To 13
  1507.          For SUIT=0 To 3
  1508.             CARD_PACK(CARD)=SUIT*100+RANK
  1509.             Inc CARD
  1510.          Next SUIT
  1511.       Next RANK
  1512.    Next P4CK
  1513. End Proc
  1514. Procedure M0USE_CHIP_MOVE
  1515.    Rem get chips to follow pointer
  1516.    If RED_CHIPS>0
  1517.       Bob B0B+1,X Screen(X Mouse),Y Screen(Y Mouse)-BLUE_CHIPS*2-1,RED_CHIPS
  1518.    Else 
  1519.       Bob Off B0B+1
  1520.    End If 
  1521.    If BLUE_CHIPS>0
  1522.       Bob B0B,X Screen(X Mouse),Y Screen(Y Mouse),BLUE_CHIPS+4
  1523.    Else 
  1524.       Bob Off B0B
  1525.    End If 
  1526. End Proc
  1527. Procedure _CLEAR_BOX
  1528.    Bob Update 
  1529.    Put Block 1
  1530.    Screen Swap : Wait Vbl 
  1531.    Put Block 1
  1532.    Screen Swap : Wait Vbl 
  1533. End Proc
  1534. Procedure _NOTICE[S$]
  1535.    W=Len(S$)/2*16+24
  1536.    H=16
  1537.    X=148-(Len(S$)/2)*8
  1538.    Y=202
  1539.    Get Block 1,X,Y,W+24,H+10
  1540.    Ink 0
  1541.    Bar X+5,Y+5 To X+W+8,Y+H+5
  1542.    Ink 1
  1543.    Bar X,Y To X+W+4,Y+H
  1544.    Ink 0
  1545.    Box X+1,Y+1 To X+W+2,Y+H-1
  1546.    Ink 2
  1547.    Curs Off 
  1548.    Screen Copy S,8,0,16,8 To S,0,0 : Screen Swap 
  1549.    Screen Copy S,8,0,16,8 To S,0,0 : Screen Swap 
  1550.    Locate 19-(Len(S$)/2),26 : Print S$;
  1551.    Bell : Wait 100
  1552.    S=Screen
  1553. End Proc
  1554. Procedure PAY_EVENS
  1555.    Shared DUBBLED(),_MODE
  1556.    BANK=BANK+STAKE(HAND)*2
  1557.    TEMP_FL=DUBBLED(HAND)
  1558.    If HAND=2
  1559.       HAND=3
  1560.    End If 
  1561.    B0B=B0B+HAND
  1562.    Channel 1 To Bob B0B
  1563.    Channel 2 To Bob B0B+1
  1564.    If BLUE_CHIPS>0
  1565.       Bob B0B,0,0,I Bob(1)
  1566.       AM$=AM$+"Move"+Str$(X Bob(HAND))+"-20,"+Str$(Y Bob(HAND))+"-19,60"
  1567.       Amal 1,AM$ : Amal On 1
  1568.    End If 
  1569.    If RED_CHIPS>0
  1570.       Bob B0B+1,0,0,I Bob(2)
  1571.       AM$="Move"+Str$(X Bob(HAND+1))+"-20,"+Str$(Y Bob(HAND+1))+"-19,60"
  1572.       Amal 2,AM$ : Amal On 2
  1573.    End If 
  1574.    If TEMP_FL and BLUE_CHIPS>0
  1575.       Bob B0B+2,0,0,I Bob(HAND+4)
  1576.       AM$="Move"+Str$(X Bob(HAND+4))+"-20,"+Str$(Y Bob(HAND+4))+"-19,60"
  1577.       Channel 3 To Bob B0B+2 : Amal 3,AM$ : Amal On 3
  1578.    End If 
  1579.    If TEMP_FL and RED_CHIPS>0
  1580.       Bob B0B+3,0,0,I Bob(HAND+5)
  1581.       AM$="Move"+Str$(X Bob(HAND+5))+"-20,"+Str$(Y Bob(HAND+5))+"-19,60"
  1582.       Channel 4 To Bob B0B+3 : Amal 4,AM$ : Amal On 4
  1583.    End If 
  1584.    If HAND=3
  1585.       HAND=2
  1586.    End If 
  1587.    Bob 42,-20,-24,66
  1588.    Channel 5 To Bob 42 : Amal 5,AM$
  1589.    Amal On 5
  1590.    Repeat : Until Chanmv(2)=0 and Chanmv(1)=0
  1591.    Amal Off 
  1592.    AM$="Move -40,-195,30"
  1593.    Amal 5,AM$ : Amal On 
  1594.    While Chanmv(5) : Wend : Amal Off 
  1595. End Proc
  1596. Procedure PAY_SIX_TO_4
  1597.    Shared BET,_MODE
  1598.    BANK=BANK+STAKE(HAND)+(STAKE(HAND)*1.5)
  1599.    Inc B0B
  1600.    Channel 1 To Bob B0B
  1601.    Channel 2 To Bob B0B+1
  1602.    Channel 3 To Bob B0B+2
  1603.    Channel 4 To Bob B0B+3
  1604.    If BLUE_CHIPS>0
  1605.       BLUE_X=X Bob(1) : BLUE_Y=Y Bob(1)
  1606.       Bob B0B,0,0,I Bob(1)
  1607.       AM$="Move"+Str$(BLUE_X)+"-20,"+Str$(BLUE_Y)+",100"
  1608.       Amal 1,AM$
  1609.    End If 
  1610.    If RED_CHIPS>0
  1611.       RED_X=X Bob(2) : RED_Y=Y Bob(2)
  1612.       Bob B0B+1,0,0,I Bob(2)
  1613.       AM$="Move"+Str$(RED_X)+"-20,"+Str$(RED_Y)+",100"
  1614.       Amal 2,AM$
  1615.    End If 
  1616.    BET2=BET/2
  1617.    If STAKE(HAND) mod 2=1
  1618.       If OWES_50P
  1619.          Inc BET2
  1620.          Inc BANK
  1621.          OWES_50P=False
  1622.       Else 
  1623.          OWES_50P=True
  1624.       End If 
  1625.    End If 
  1626.    If _MODE=0
  1627.       If BET2>0
  1628.          MAKE_CHIP_PILE[BET2]
  1629.          If BLUE_CHIPS>0
  1630.             Bob B0B+2,0,0,4+BLUE_CHIPS
  1631.             AM$="Move"+Str$(BLUE_X)+"-40,"+Str$(BLUE_Y)+",100"
  1632.             Amal 3,AM$
  1633.          End If 
  1634.          If RED_CHIPS>0
  1635.             Bob B0B+3,0,0,RED_CHIPS
  1636.             AM$="Move"+Str$(Max(BLUE_X,RED_X))+"-40,"
  1637.             AM$=AM$+Str$(Max(BLUE_Y,RED_Y))+"-5,100"
  1638.             Amal 4,AM$
  1639.          End If 
  1640.       End If 
  1641.       Bob 42,-20,-24,66
  1642.       Channel 5 To Bob 42
  1643.       Amal 5,AM$
  1644.       Amal On 
  1645.       While Chanmv(1) or Chanmv(2) or Chanmv(3) or Chanmv(4)
  1646.       Wend 
  1647.       Wait 5
  1648.       AM$="Move -40,-190,30"
  1649.       Amal 5,AM$ : Amal On 
  1650.       While Chanmv(5) : Wend 
  1651.    End If 
  1652. End Proc
  1653. Procedure _PROCESS[G$]
  1654.    Menu Off 
  1655.    Screen Open 4,640,250,4,Hires
  1656.    View 
  1657.    Curs Off 
  1658.    Restore G$
  1659.    A$=""
  1660.    LINE=0
  1661.    While A$<>"**"
  1662.       Read A$
  1663.       Locate 0,LINE
  1664.       If A$="*"
  1665.          Print " "
  1666.          Print "               Left Mouse Button to continue."
  1667.          Wait 20
  1668.          While Mouse Key<>1 : Wend 
  1669.          Cls 
  1670.          LINE=0
  1671.       Else 
  1672.          Print A$
  1673.          Inc LINE
  1674.          X=Free
  1675.       End If 
  1676.    Wend 
  1677.    Screen Close 4
  1678.    Menu On 
  1679.    RULES:
  1680.    Data "                          Rules of the House."
  1681.    Data "                          ==================="
  1682.    Data " "
  1683.    Data "1. Four decks of cards are used, and after each shuffle approximately"
  1684.    Data "   12 cards are 'burned' from the bottom of the pack."
  1685.    Data "   Each card has its face value.  Court cards count as ten.  Aces count"
  1686.    Data "   as either 1 or 11, whichever is to the hand's advantage."
  1687.    Data " "
  1688.    Data "2. The player must bet before any cards are dealt."
  1689.    Data " "
  1690.    Data "3. All cards are dealt face up.  The dealer will deal two cards to the"
  1691.    Data "   player and one to himself.  Only after the player has completed his"
  1692.    Data "   hand will the dealer deal more cards to himself."
  1693.    Data " "
  1694.    Data "4. Any hand with a count of over 21 is 'bust'."
  1695.    Data " "
  1696.    Data "5. Dealer stands on a hand of 17 or more, whether hard or soft."
  1697.    Data " "
  1698.    Data "6. Dealer must hit a hand of 16 or less."
  1699.    Data " "
  1700.    Data "7. Player may stand at any time."
  1701.    Data " "
  1702.    Data "8. Player may double his bet after the second card.  In this case"
  1703.    Data "   only one more card will be dealt to that hand."
  1704.    Data "*"
  1705.    Data " "
  1706.    Data "9.  Player may split his hand if his first two cards are of equal value."
  1707.    Data "    Only one split is permitted per hand.  The second hand will carry the"
  1708.    Data "    same stake as the initial hand."
  1709.    Data " "
  1710.    Data "10. Your stake is returned in the case of a draw or'Stand Off'."
  1711.    Data " "
  1712.    Data "11. A player winning with a Blackjack (an Ace plus ten or a Court card)"
  1713.    Data "    will be paid one and a half times his stake, except in split hands,"
  1714.    Data "    when the hand will be treated as a normal count of 21."
  1715.    Data "    (As there are no 50p chips, in the case of Blackjack on a bet of an"
  1716.    Data "    odd amount, the extra 50p will be added to the next similar payout"
  1717.    Data "    thus rounding it up.)"
  1718.    Data " "
  1719.    Data "12. In the event of the dealer getting Blackjack the dealer wins unless the"
  1720.    Data "    player has Blackjack, in which case it will count as a draw."
  1721.    Data "*"
  1722.    Data "**"
  1723.    _INSTRUCT:
  1724.    Data "                         INSTRUCTIONS."
  1725.    Data "                         ============="
  1726.    Data "   The Game."
  1727.    Data "   ---------"
  1728.    Data "   The player must place a bet before any cards are dealt.  To do this"
  1729.    Data "   use the mouse to pick up chips from either or both of the two boxes"
  1730.    Data "   marked '�1' and '�5'.  The left mouse button will pick up chips"
  1731.    Data "   (increase the bet); the right button will drop chips (decrease the"
  1732.    Data "   bet)."
  1733.    Data " "
  1734.    Data "   To place the bet simply move the chips into the betting box with"
  1735.    Data "   the mouse and press the left button."
  1736.    Data " "
  1737.    Data "   The dealer will deal two cards to the player and one to himself."
  1738.    Data "   It is now up the player make his choice of 'Stand', 'Hit', 'Double', or"
  1739.    Data "   'Split' where allowable."
  1740.    Data " "
  1741.    Data "    The object of the game, for both player and dealer, is to get as high"
  1742.    Data "   a score as possible without going over 21."
  1743.    Data " "
  1744.    Data "   Once the player has either bust (gone over 21) or stood (stopped"
  1745.    Data "   drawing cards) on all his hands the dealer will deal his hand"
  1746.    Data "   according to the rules."
  1747.    Data " "
  1748.    Data "   After each hand a fresh bet must be placed before the game can"
  1749.    Data "   continue. "
  1750.    Data "*"
  1751.    Data " "
  1752.    Data "                              OPTIONS."
  1753.    Data "                              ========"
  1754.    Data " "
  1755.    Data "   If 'Play with Help' has been selected from the Options menu, one"
  1756.    Data "   of the four red lights beside the play buttons will flash.  This is"
  1757.    Data "   the advised play for the player's card count, having taken the dealer's"
  1758.    Data "   card into consideration."
  1759.    Data " "
  1760.    Data "   If 'Play without Help' has been selected, advice is still available"
  1761.    Data "   from the 'Help' key."
  1762.    Data " "
  1763.    Data "   The advice is based on the strategy file which is currently loaded."
  1764.    Data "   To alter the strategy select 'Edit Strategy' from the 'Options' menu"
  1765.    Data "   To save a strategy to disc select 'Save Strategy'.  Each strategy file"
  1766.    Data "   MUST be given '.str' as an extension to the file name.  'Load Strategy'"
  1767.    Data "   will allow the user to select a previously saved Strategy file."
  1768.    Data " "
  1769.    Data "   The 'Select Speed' option allows the player to vary the speed at which"
  1770.    Data "   the cards are dealt."
  1771.    Data " "
  1772.    Data "*"
  1773.    Data " "
  1774.    Data "   'Test Current Strategy' will enable a Strategy to be tested by"
  1775.    Data "   instructing the computer to play up to 10,000 hands using the Strategy"
  1776.    Data "   currently loaded."
  1777.    Data " "
  1778.    Data "   While playing a player may save a game to disc or load a  "
  1779.    Data "   previously saved game using the LOAD and SAVE buttons."
  1780.    Data "   The MENU button will return the player to the Menu Screen."
  1781.    Data "   These three buttons only function between hands."
  1782.    Data " "
  1783.    Data "   (See Docs for further details.)"
  1784.    Data "*"
  1785.    Data "**"
  1786.    STRATEGY:
  1787.    Data "                             Strategy"
  1788.    Data "                             ========"
  1789.    Data ""
  1790.    Data " "
  1791.    Data "       At first glance the dealer has an enormous advantage in"
  1792.    Data "    Blackjack, because he does not have to draw cards to his hand"
  1793.    Data "    until all the players have either Stood or Bust.  So that if"
  1794.    Data "    both the player and the dealer bust, the dealer wins on what"
  1795.    Data "    is, in effect, a draw."
  1796.    Data " "
  1797.    Data "       To counter-balance this the player is allowed to Stand at"
  1798.    Data "    any time, whereas the dealer MUST Hit a hand of sixteen or"
  1799.    Data "    less.  In addition, the player is given the opportunity to"
  1800.    Data "    increase his stake when the cards are in his favour, and"
  1801.    Data "    the player gets paid at odds of six to four on a Blackjack."
  1802.    Data " "
  1803.    Data "       It follows that a knowledge of what are 'good' and what"
  1804.    Data "    are 'bad' hands will help your money go that much further"
  1805.    Data "    and, who knows, one day you may actually win something."
  1806.    Data "*"
  1807.    Data " "
  1808.    Data "       There follows a table of what this program will train you"
  1809.    Data "    to do using the default Strategy. "
  1810.    Data " "
  1811.    Data "       If you wish to alter the strategy simply select 'Edit Strategy'"
  1812.    Data "    from the Options Menu and edit the chart to your liking.  "
  1813.    Data " "
  1814.    Data "    (Note: The term 'Hard hand' refers to hand which does not"
  1815.    Data "    have any aces in it or a Soft hand which has gone over 21.)"
  1816.    Data "*"
  1817.    Data " "
  1818.    Data "    PLAYER                PLAY"
  1819.    Data "    ======                ===="
  1820.    Data " "
  1821.    Data "    Hitting on Hard Hands"
  1822.    Data " "
  1823.    Data "    Less than 12           Always Hit.  Cannot Bust."
  1824.    Data "    12                     Hit when dealer has 2 or 3."
  1825.    Data "    12 - 16                Hit when dealer has more than 6."
  1826.    Data " "
  1827.    Data "    Hitting Soft Hands"
  1828.    Data " "
  1829.    Data "    18 (Ace+7)             Hit when dealer has 9 or 10."
  1830.    Data "    Less than 18           Always Hit."
  1831.    Data "*"
  1832.    Data " "
  1833.    Data "    PLAYER                 PLAY"
  1834.    Data "    ======                 ===="
  1835.    Data " "
  1836.    Data "    Doubling Hard Hands"
  1837.    Data " "
  1838.    Data "    11                     Always Double."
  1839.    Data "    10                     When dealer has 2-9"
  1840.    Data "     9                     When dealer has 2-6"
  1841.    Data " "
  1842.    Data "    Doubling Soft Hands"
  1843.    Data " "
  1844.    Data "    13 to 16               When dealer has 4-6"
  1845.    Data "    17                     When dealer has 2-6"
  1846.    Data "    18                     When dealer has 3-6"
  1847.    Data "*"
  1848.    Data " "
  1849.    Data "    PLAYER                 PLAY"
  1850.    Data "    ======                 ===="
  1851.    Data ""
  1852.    Data "    Splitting"
  1853.    Data " "
  1854.    Data "    Aces and 8s            Always Split."
  1855.    Data "    10s and 5s             Never Split. "
  1856.    Data "    9s                     Not when dealer has 7,10 or Ace."
  1857.    Data "    7s                     When dealer has 2-8."
  1858.    Data "    6s                     When dealer has 2-7."
  1859.    Data "    4s                     When dealer has 5."
  1860.    Data "    3s and 2s              When dealer has 2-7."
  1861.    Data "*"
  1862.    Data "**"
  1863.    DETAILS:
  1864.    Data "    Blackjack Trainer is written by Peter Cartwright using the"
  1865.    Data "    AMOS Compiler."
  1866.    Data " "
  1867.    Data "    Many thanks to Kevin Hall for the samples, moral support and"
  1868.    Data "    suggestions."
  1869.    Data " "
  1870.    Data "    Address any comments, brickbats or donations to:"
  1871.    Data " "
  1872.    Data "       Peter Cartwright,"
  1873.    Data "       68a Dornton Road,"
  1874.    Data "       London. SW12 9NE."
  1875.    Data "       081 673 0971."
  1876.    Data "*"
  1877.    Data "**"
  1878.    STAKING:
  1879.    Data " "
  1880.    Data "                   STAKING PLANS."
  1881.    Data " "
  1882.    Data "  When 'Test Current Strategy' is selected from the Options"
  1883.    Data "  Menu you will be offered a choice of eight staking plans to"
  1884.    Data "  use in your test runs.  Please refer to the Docs file for details"
  1885.    Data "  of what each staking plan will do."
  1886.    Data " "
  1887.    Data "  There is room for eight more staking plans in the program. so if"
  1888.    Data "  you have any staking systems which you would like to test over"
  1889.    Data "  long runs I will gladly customise the program for you for ï¿½2"
  1890.    Data "  plus ï¿½3 per staking plan.  Please read the Docs file for details."
  1891.    Data "*"
  1892.    Data "**"
  1893. End Proc
  1894. Procedure _SAVE_STRAT
  1895.    F$="" : While F$=""
  1896.       F$=Fsel$("*.STR","","Save a Strategy File","MUST have '.STR' as extension")
  1897.       If F$<>""
  1898.          A$=Upper$(F$)
  1899.          If Right$(A$,4)=".STR"
  1900.             Bsave F$,Start(8) To Start(8)+Length(8)
  1901.          Else 
  1902.             F$=""
  1903.          End If 
  1904.       Else 
  1905.          F$=" "
  1906.       End If 
  1907.    Wend 
  1908. End Proc
  1909. Procedure _SAVE_GAME
  1910.    Shared CARD_PACK(),T0P_CARD,BOTTOM_CARD
  1911.    _LOOP:
  1912.    F$=Fsel$("*.GAM","","Save a .GAM file","MUST have .GAM extention")
  1913.    If F$="" Then Goto _EXIT1
  1914.    If Upper$(Right$(F$,4))<>".GAM" Then Goto _LOOP
  1915.    S$="Saving ..." : _NOTICE[S$]
  1916.    Open Out 1,F$
  1917.    Print #1,BANK
  1918.    Print #1,T0P_CARD
  1919.    Print #1,BOTTOM_CARD
  1920.    For X=1 To 208 : Print #1,CARD_PACK(X) : Next X
  1921.    Close 1
  1922.    _CLEAR_BOX
  1923.    _EXIT1:
  1924. End Proc
  1925. Procedure _LOAD_GAME
  1926.    Shared CARD_PACK(),T0P_CARD,BOTTOM_CARD
  1927.    F$=Fsel$("*.GAM","","Load A GAME FILE ")
  1928.    If F$="" Then Goto _EXIT2
  1929.    S$="Loading... "
  1930.    _NOTICE[S$]
  1931.    Open In 1,F$
  1932.    Input #1,BANK
  1933.    Input #1,T0P_CARD
  1934.    Input #1,BOTTOM_CARD
  1935.    For X=1 To 208 : Input #1,CARD_PACK(X) : Next X
  1936.    Close 1
  1937.    _CLEAR_BOX
  1938.    _UPDATE_BANK
  1939.    _EXIT2:
  1940. End Proc
  1941. Procedure SET_MAIN_ZONES
  1942.    Reserve Zone 
  1943.    Reserve Zone 10
  1944.    For I=1 To 6
  1945.       Read TLX,TLY,BRX,BRY
  1946.       Set Zone I+4,TLX,TLY To BRX,BRY
  1947.    Next I
  1948.    For I=0 To 3
  1949.       Set Zone I+1,3,106+16*I To 53,122+16*I
  1950.       Wait Vbl 
  1951.    Next I
  1952.    Data 130,174,162,194
  1953.    Data 161,174,194,194
  1954.    Data 142,104,175,158
  1955.    Data 35,208,81,219
  1956.    Data 245,208,291,219
  1957.    Data 135,224,185,240
  1958. End Proc
  1959. Procedure TAKE_MONEY
  1960.    Shared DUBBLED()
  1961.    TEMP_FL=DUBBLED(HAND)
  1962.    If HAND=2 Then HAND=3
  1963.    Channel 1 To Bob HAND
  1964.    Channel 2 To Bob HAND+1
  1965.    AM$="Move -70,-160,45"
  1966.    If BLUE_CHIPS>0
  1967.       Amal 1,AM$
  1968.       GRABBER_POSX=X Bob(HAND)-20 : GRABBER_POSY=Y Bob(HAND)-24
  1969.    End If 
  1970.    If RED_CHIPS>0
  1971.       Amal 2,AM$
  1972.       GRABBER_POSX=X Bob(HAND+1)-20 : GRABBER_POSY=Y Bob(HAND+1)-24
  1973.    End If 
  1974.    ' take care of doubles 
  1975.    If TEMP_FL and BLUE_CHIPS>0
  1976.       Channel 3 To Bob HAND+4 : Amal 3,AM$
  1977.    End If 
  1978.    If TEMP_FL and RED_CHIPS>0
  1979.       Channel 4 To Bob HAND+5 : Amal 4,AM$
  1980.    End If 
  1981.    Bob 42,GRABBER_POSX,GRABBER_POSY,66
  1982.    Wait 20
  1983.    Channel 5 To Bob 42
  1984.    Amal 5,AM$
  1985.    Amal On 
  1986.    If HAND=3 Then HAND=2
  1987.    Wait 50
  1988. End Proc
  1989. Procedure _UPDATE_BANK
  1990.    Text 68,188,"�"+Str$(BANK)+"  "
  1991. End Proc
  1992. Procedure _SET_UP_1ST_SCREENS
  1993.    Auto View Off 
  1994.    Screen Open 0,320,256,16,Lowres
  1995.    Flash Off : Curs Off 
  1996.    Load "Trainer:table.pic.pac",9
  1997.    Unpack 9 To 0 : Erase 9
  1998.    Screen Hide 0
  1999.    Double Buffer 
  2000.    Palette ,,,$191
  2001.    Limit Mouse 128,42 To 444,298
  2002.    Screen Open 1,320,256,16,Lowres
  2003.    Auto View On 
  2004.    Load "Trainer:bj_menuscreen.pac",10
  2005.    Flash Off 
  2006.    Unpack 10 To 1 : Erase 10
  2007.    Screen Display 0,128,298,,
  2008. End Proc
  2009. Procedure _SAY_WAIT
  2010.    S$="Please Wait..."
  2011.    Ink 0
  2012.    Bar 100,146 To 230,166
  2013.    Ink 1
  2014.    Box 102,148 To 228,164
  2015.    Paper 0 : Pen 1
  2016.    Locate 14,19 : Print S$;
  2017.    X=Free
  2018. End Proc
  2019. Procedure _SCROLL_UP
  2020.    Screen Show 0
  2021.    SY1=42 : SY2=298
  2022.    For Z=1 To 64 : Wait Vbl : Screen Display 1,128,SY1,, : Screen Display 0,128,SY2,, : SY1=SY1-4 : SY2=SY2-4 : Next Z
  2023.    Screen Hide 1
  2024. End Proc
  2025. Procedure _SCROLL_DOWN
  2026.    Screen Show 1
  2027.    SY1=-214 : SY2=42
  2028.    For Z=1 To 64 : Wait Vbl : Screen Display 1,128,SY1,, : Screen Display 0,128,SY2,, : SY1=SY1+4 : SY2=SY2+4 : Next Z
  2029.    Screen Hide 0
  2030. End Proc